package com.yunxi.controller;

import com.alibaba.fastjson.JSON;
import com.yunxi.entity.AccountInfo;
import com.yunxi.service.api.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private IAccountService accountService;

    @RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    public String getAccountName(@PathVariable Long id) {
        AccountInfo accountInfo = accountService.getAccountName(id);
        return JSON.toJSONString(accountInfo);
    }

}
